package com.hpf.cloud.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.TypeAlias;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDateTime;

/**
 * @description: 错误码es对应的实体
 * @datetime: 2020/12/4 23:32
 * @author: huangpengfei
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
@Document(indexName = "error_code", shards = 1, replicas = 1)
@TypeAlias("error_code")
public class ErrorCode {

    @Id
    private Long id;
    /**
     * 错误码
     */
    @Field(type = FieldType.Keyword, analyzer = "ik_max_word")
    private String errorCode;
    /**
     * 错误码中文
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String errorDescZh;
    /**
     * 错误码英文
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String errorDescEn;
    /**
     * 解决方案 中文
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String solutionZh;
    /**
     * 解决方案 英文
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String solutionEn;
    /**
     * 所属应用
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String module;
    /**
     * 创建时间
     */
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime createTime;
    /**
     * 创建人
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String createUser;
    /**
     * 更新时间
     */
    @Field(type = FieldType.Date, format = DateFormat.date_hour_minute_second)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private LocalDateTime updateTime;
    /**
     * 更新人
     */
    @Field(type = FieldType.Text, analyzer = "ik_max_word")
    private String updateUser;
    /**
     * 物理标识 1 未删除 0已删除
     */
    @Field(type = FieldType.Integer)
    private Integer physicalFlag;
}
